package com.sky.financelake.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatTextView;

import com.sky.financelake.base.BaseF;
import com.sky.financelake.databinding.FragmentHomeBinding;
import com.sky.financelake.ui.activity.PdfViewA;
import com.sky.financelake.ui.activity.PlateZjlxA;
import com.sky.financelake.ui.activity.PlateZjlxRankA;
import com.sky.financelake.ui.activity.StockZjlxA;
import com.sky.financelake.utils.LoadingUtil;

import dagger.hilt.android.AndroidEntryPoint;

@AndroidEntryPoint
public class HomeF extends BaseF {

    private FragmentHomeBinding binding;
    private LoadingUtil loadingUtil;

    public static class SingleHolder {
        private static HomeF instance = new HomeF();
    }

    private HomeF() {
    }

    public static HomeF newInstance() {
        return SingleHolder.instance;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = FragmentHomeBinding.inflate(getLayoutInflater());
        loadingUtil = LoadingUtil.newInstance(binding.getRoot());

        AppCompatTextView labelZjlx = binding.labelZjlx;
        AppCompatButton btnPre = binding.btnPreview;

        btnPre.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(requireContext(), PdfViewA.class));
            }
        });

        AppCompatTextView btnPlateZjlxRank = binding.btnPlateZjlxRank;
        btnPlateZjlxRank.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(requireContext(), PlateZjlxRankA.class));
            }
        });


        AppCompatTextView btnStockZjlx = binding.btnStockZjlx;
        btnStockZjlx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(requireContext(), StockZjlxA.class));
            }
        });

        AppCompatTextView btnPlateZjlx = binding.btnPlateZjlx;
        btnPlateZjlx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(requireContext(), PlateZjlxA.class));
            }
        });


        return binding.getRoot();
    }
}
